from rest_framework import serializers
from myapp.models import LoginModel,BookCateModel,Get_BookModel,WaitBookModel,IwantLookModel
class LoginSerializer(serializers.ModelSerializer):
    class Meta:
        model=LoginModel
        fields="__all__"
class WaitBookSerializer(serializers.ModelSerializer):
    img=serializers.ImageField(required=True)
    class Meta:
        model=WaitBookModel
        fields="__all__"
class IwantLookSerializer(serializers.ModelSerializer):
    want_cate=serializers.SerializerMethodField(read_only=True)
    def get_want_cate(self,obj):
        return obj.book_cate.name
    class Meta:
        model=IwantLookModel
        fields="__all__"
class GetBookSerializer(serializers.ModelSerializer):
    class Meta:
        model=Get_BookModel
        fields="__all__"